home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / AMScen_0_9.lha / AMScen / proving0.m < prev    next >
Text File  |  1995-01-21  |  48KB  |  1,401 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1995 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * proving0.m - surface level of the proving grounds.
  9.  */
  10.  
  11. use t_streets
  12.  
  13. /*
  14.  * monsterDrink - used for the drinking troll and the drinking goblin.
  15.  *    Half the time they will try to drink, other half will do normal stuff.
  16.  */
  17.  
  18. define tp_proving proc monsterDrink()bool:
  19.  
  20.     if FindName(Here()@p_rContents, p_oName, "water") = succeed and
  21.     Random(2) = 0
  22.     then
  23.     ignore Parse(G, "drink water");
  24.     else
  25.     DoMonsterMove(Me());
  26.     fi;
  27.     MonsterReschedule(Me());
  28.     true
  29. corp;
  30.  
  31. private tp_proving0 CreateTable().
  32. use tp_proving0
  33.  
  34. define tp_proving0 proc monsterSet1(thing room)void:
  35.  
  36.     InitMonsterModels(room, 300);
  37.     AddPossibleMonster(room, m_rat, 25);
  38.     AddPossibleMonster(room, m_snake, 25);
  39.     AddPossibleMonster(room, m_dog, 25);
  40.     AddPossibleMonster(room, m_gremlin, 25);
  41. corp;
  42.  
  43. define tp_proving0 proc monsterSetP(thing room)void:
  44.  
  45.     InitMonsterModels(room, 325);
  46.     AddPossibleMonster(room, m_rat, 20);
  47.     AddPossibleMonster(room, m_snake, 35);
  48.     AddPossibleMonster(room, m_dog, 20);
  49.     AddPossibleMonster(room, m_gremlin, 20);
  50.     AddPossibleMonster(room, m_deer, 25);
  51. corp;
  52.  
  53. define tp_proving0 m_birds CreateMonsterModel("birds;pair,of.pair",
  54.     "The birds sing nicely, but they are nothing special to look at.",
  55.     MonsterInit, RandomMove,
  56.     0, 20, 0, 0, 0, 0).
  57. GNewIcon(m_birds, makeBirdIcon()).
  58. define tp_proving0 proc birdsHit(thing theBirds)void:
  59.     Print("The birds flutter out of reach.\n");
  60.     OPrint(Me()@p_pName +
  61.     " takes a swipe at the birds, but they flutter out of reach.\n");
  62. corp;
  63. m_birds@p_mFightAction := birdsHit.
  64. /* birds will sing once, then leave */
  65. define tp_proving0 BIRDS_SING_ID NextSoundEffectId().
  66. define tp_proving0 proc birdsSingOnce(thing client)void:
  67.     if SOn(client) then
  68.     SPlaySound(client, "birds", BIRDS_SING_ID);
  69.     IfFound(client);
  70.     Else(client);
  71.         FailText(client, "The birds sing.");
  72.     Fi(client);
  73.     else
  74.     SPrint(client, "The birds sing.\n");
  75.     fi;
  76. corp;
  77. define tp_proving0 proc birdsSing()bool:
  78.     ForEachAgent(Here(), birdsSingOnce);
  79.     Me()@p_mMovesUntilVanish := 0;
  80.     MonsterReschedule(Me());
  81.     true
  82. corp;
  83. m_birds@p_mSpecialAction := birdsSing.
  84.  
  85. define tp_proving0 m_drinkingTroll CreateThing(m_troll).
  86. m_drinkingTroll@p_mSpecialAction := monsterDrink.
  87.  
  88. define tp_proving0 proc monsterSet2(thing room)void:
  89.  
  90.     InitMonsterModels(room, 400);
  91.     AddPossibleMonster(room, m_wolf, 25);
  92.     AddPossibleMonster(room, m_blackBear, 25);
  93.     AddPossibleMonster(room, m_deer, 25);
  94.     AddPossibleMonster(room, m_moose, 25);
  95.     AddPossibleMonster(room, m_drinkingTroll, 25);
  96.     AddPossibleMonster(room, m_birds, 25);
  97. corp;
  98.  
  99. define tp_proving0 r_warning CreateThing(r_outdoors).
  100. SetupRoom(r_warning, "on an east-west path", "").
  101. Connect(r_path2, r_warning, D_WEST).
  102. AutoGraphics(r_warning, AutoPaths).
  103. ExtendDesc(r_path2, "A sign reading 'To the Proving Grounds' points along "
  104.     "a path heading west.").
  105. Sign(r_path2, "sign;simple,painted,wooden",
  106.     "The sign is a simple painted wooden sign on a post.",
  107.     "To the Proving Grounds").
  108. define tp_proving proc warning()status:
  109.     if not Me()@p_pInited then
  110.     Print(
  111. "\nWARNING: The area to the west of here is a combat zone. If you chose to "
  112. "enter that area, you may be subject to immediate attack. Entering the area "
  113. "will enable combat for your player. Once enabled, combat cannot be "
  114. "disabled.\n\n");
  115.     fi;
  116.     continue
  117. corp;
  118. AddWestChecker(r_path2, warning, false).
  119.  
  120. /* Some generic rooms for this level proving grounds. */
  121.  
  122. define tp_proving0 r_provingRoad CreateThing(r_road).
  123. SetThingStatus(r_provingRoad, ts_readonly).
  124. AutoGraphics(r_provingRoad, AutoRoads).
  125. AutoPens(r_provingRoad, C_FOREST_GREEN, C_TAN, 0, 0).
  126. monsterSet1(r_provingRoad).
  127.  
  128. define tp_proving0 r_provingField CreateThing(r_field).
  129. SetThingStatus(r_provingField, ts_readonly).
  130. monsterSet1(r_provingField).
  131.  
  132. define tp_proving0 r_provingForest CreateThing(r_forest).
  133. SetThingStatus(r_provingForest, ts_readonly).
  134. monsterSet2(r_provingForest).
  135.  
  136. define tp_proving0 r_entrance CreateThing(r_provingRoad).
  137. SetupRoom(r_entrance, "at the proving grounds entrance",
  138.     "A small, grimy tent is to the north, and a somewhat cleaner tent is "
  139.     "to the south. The path from the east turns into a cobbled road at "
  140.     "this point and continues to the west.").
  141. Connect(r_warning, r_entrance, D_WEST).
  142. r_warning@p_rNoMachines := true.
  143. Scenery(r_entrance, "tent;small,grimy,clean,cleaner.road;cobbled").
  144. define tp_proving0 proc enterProvingGrounds()status:
  145.     if not Me()@p_pInited then
  146.     Print(
  147.         "Welcome to the proving grounds! You are hereby warned that "
  148.         "this area is not safe to just wander around in. It contains "
  149.         "monsters, etc. which will attempt to harm you. You should find "
  150.         "suitable weapons and armour to help protect yourself. You can "
  151.         "see your current statistics with the 'status' command.\n");
  152.     InitFighter(Me());
  153.     fi;
  154.     continue
  155. corp;
  156. AddWestChecker(r_warning, enterProvingGrounds, false).
  157. AddEastChecker(r_entrance, LeaveFighting, false).
  158. define tp_proving0 PR_ENTRANCE_ID NextEffectId().
  159. define tp_proving0 proc drawEntrance()void:
  160.  
  161.     if not KnowsEffect(nil, PR_ENTRANCE_ID) then
  162.     DefineEffect(nil, PR_ENTRANCE_ID);
  163.     GSetImage(nil, "pr_entrance");
  164.     IfFound(nil);
  165.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  166.     Else(nil);
  167.         GSetPen(nil, C_FOREST_GREEN);
  168.         GAMove(nil, 0, 0);
  169.         GRectangle(nil, 159, 99, true);
  170.         GSetPen(nil, C_TAN);
  171.         GAMove(nil, 0, 38);
  172.         GRectangle(nil, 129, 24, true);
  173.         GAMove(nil, 130, 46);
  174.         GRectangle(nil, 29, 8, true);
  175.         GSetPen(nil, C_DARK_BLUE);
  176.         GAMove(nil, 20, 0);
  177.         GRectangle(nil, 119, 33, true);
  178.         GSetPen(nil, C_LEMON_YELLOW);
  179.         GAMove(nil, 20, 67);
  180.         GRectangle(nil, 119, 32, true);
  181.         GSetPen(nil, C_BRICK_RED);
  182.         GAMove(nil, 75, 33);
  183.         HorizontalDoor();
  184.         GAMove(nil, 75, 67);
  185.         HorizontalDoor();
  186.     Fi(nil);
  187.     EndEffect();
  188.     fi;
  189.     CallEffect(nil, PR_ENTRANCE_ID);
  190. corp;
  191. AutoGraphics(r_entrance, drawEntrance).
  192.  
  193. /* Add an armoury to buy basic goods at */
  194.  
  195. define tp_proving0 r_armoury CreateThing(r_indoors).
  196. SetupRoom(r_armoury, "in an armoury",
  197.     "This small establishment is run by a nasty-looking individual who "
  198.     "appears to be his own best customer. He is a short, but very heavyset "
  199.     "man with a dirty beard and greasy hair. He wears armoured boots, heavy "
  200.     "chain gauntlets, plate mail and an iron helm. The handle of a huge "
  201.     "sword can be seen behind his head, and a couple of handy daggers are "
  202.     "tucked into a loose belt. Perhaps he doesn't trust his clientele.").
  203. Connect(r_entrance, r_armoury, D_NORTH).
  204. UniConnect(r_armoury, r_entrance, D_EXIT).
  205. AutoGraphics(r_armoury, AutoOpenRoom).
  206. r_armoury@p_rNoMachines := true.
  207. Scenery(r_armoury,
  208.     "man,individual,shopkeeper,storekeeper;nasty-looking,nasty,looking,short."
  209.     "beard,hair;dirty,greasy."
  210.     "boot;armoured."
  211.     "gauntlet,glove;heavy,chain."
  212.     "helm,helmet;iron."
  213.     "sword;huge."
  214.     "handle;huge,sword."
  215.     "dagger;handy."
  216.     "belt;loose").
  217. MakeStore(r_armoury).
  218. ignore WeaponSell(r_armoury, "dagger",
  219.     "The dagger is nothing special - just a large, heavy knife. The blade "
  220.     "is fairly sharp, and should last.",
  221.     10, 0, 0, 0, 0, 0, 6, 3).
  222. define tp_proving o_stiletto WeaponSell(r_armoury,
  223.     "stiletto,stilleto,stileto,stilletto;fine",
  224.     "The stiletto is like a long dagger with a very narrow blade. It is "
  225.     "ideal for sticking into small places, like between ribs.",
  226.     15, 0, 0, 0, 0, 0, 8, 5).
  227. define tp_proving o_shortSword WeaponSell(r_armoury, "sword;short",
  228.     "The short sword is halfway between a dagger and a true sword. It is "
  229.     "just under two feet long, and has a small straight guardpiece separating "
  230.     "the double-edged blade from the cord-wrapped hilt.",
  231.     50, 0, 0, 0, 0, 0, 7, 7).
  232. define tp_proving o_longSword WeaponSell(r_armoury, "sword;long",
  233.     "The long sword is nearly three feet long and both edges are sharpened. "
  234.     "The tip is also quite sharp, but not as sharp as those on smaller "
  235.     "weapons. The guardpiece between the blade and the hilt is about four "
  236.     "inches long, providing fair protection to the hand. There is a small "
  237.     "metal pommel on the end of the leather-wrapped grip.",
  238.     200, 0, 0, -1, 0, 0, 8, 11).
  239. define tp_proving o_twoHandedSword WeaponSell(r_armoury,
  240.     "sword;two-handed.sword;two,handed",
  241.     "The two-handed sword is a large, heavy weapon. It is about four feet "
  242.     "long and has a six-inch hand-guard which curves out over the blade, "
  243.     "serving to catch and hold other weapons sliding along the blade. The "
  244.     "hilt is nearly a foot long, and there is a large pommel on the end of "
  245.     "it. The grip area is wrapped in wide leather strips, providing a good "
  246.     "grip.",
  247.     400, 0, 0, -2, 0, 0, 8, 16).
  248. ignore WeaponSell(r_armoury, "axe,ax;war",
  249.     "The war axe is much like a chopping axe, except that the blade is much "
  250.     "wider - it only has to chop flesh, not wood. There is a decorative "
  251.     "tassle on the end of the handle.",
  252.     150, 0, 0, -1, 0, 0, 6, 11).
  253. ignore WeaponSell(r_armoury, "poleaxe,poleax.axe,ax;pole.pole",
  254.     "The poleaxe is an odd-looking but highly effective weapon. It has an "
  255.     "iron head which is a wide axe-blade on one side and a long spike on the "
  256.     "other. Thus it can be used for chopping actions and for spiking through "
  257.     "things. The head is on the end of a long shaft, which has a further "
  258.     "spike on its end.",
  259.     125, 0, 0, 0, 0, 0, 9, 8).
  260. define tp_proving o_leatherArmour WeaponSell(r_armoury, "armour;leather",
  261.     "Leather armour provides reasonable protection against small weapons, "
  262.     "but it is little help against larger ones.",
  263.     100, 0, 0, 0, -2, 0, 0, 0).
  264. ignore WeaponSell(r_armoury, "armour;studded",
  265.     "The studded armour is made of boiled leather with many bronze studs "
  266.     "attached to it. The studs server to deflect and catch weapons that are "
  267.     "swung against the armour. The boiled leather is considerable tougher "
  268.     "than normal leather, and hence provides more protection.",
  269.     350, 0, 0, 0, -3, 0, 0, 0).
  270. ignore WeaponSell(r_armoury, "mail;chain.chain",
  271.     "Chain mail consists of a shirtlike contrivance made from small iron "
  272.     "links, much as a chain is made from links. Being metal, it provides "
  273.     "good protection against many weapons. A strong thrust can still break "
  274.     "the links, however.",
  275.     700, 0, 0, 0, -4, 0, 0, 0).
  276. ignore WeaponSell(r_armoury, "mail;plate.plate",
  277.     "Plate armour is the ultimate in non-magical personal protection. Many "
  278.     "formed metal plates are attached to a leather framework and worn like "
  279.     "a heavy coat. The plates overlap near joints, so that gaps do not "
  280.     "appear when moving.",
  281.     2000, 0, 0, 0, -5, 0, 0, 0).
  282. define tp_proving o_woodenShield WeaponSell(r_armoury,
  283.     "shield;wooden.shield;wood",
  284.     "The woode shield is made from many strips of wood glued together to "
  285.     "form a rough circle. It is about one inch thick, and has a leather "
  286.     "strap on the back for holding it.",
  287.     75, 0, 0, 0, 0, -2, 0, 0).
  288. ignore WeaponSell(r_armoury, "shield;bronze",
  289.     "The bronze shield is no heavier than a wooden shield, but provides "
  290.     "much better protection against piercing attacks. It also has a spike "
  291.     "in the middle of its face which can be used to force weapons aside.",
  292.     200, 0, 0, 0, 0, -3, 0, 0).
  293. ignore WeaponSell(r_armoury, "shield;iron",
  294.     "The iron shield is pretty much the same as a bronze shield, except that "
  295.     "it is much heavier, and is strong enough to resist nearly all puncture "
  296.     "attacks.",
  297.     500, 0, 0, 0, 0, -4, 0, 0).
  298. ignore WeaponSell(r_armoury, "sword;flashing",
  299.     "This sword is a bit out of the ordinary. It has quite pretty scrollwork "
  300.     "on the blade, mostly in the form of lightning bolts; and the pommel "
  301.     "contains a large red gem.",
  302.     1000000, 0, 0, 5, 0, 0, 7, 11).
  303. ignore WeaponSell(r_armoury, "Thor;Hammer,of.hammer",
  304.     "The Hammer of Thor appears to be a special weapon. It smashes instead "
  305.     "of slashes, but that is likely to be just as effective. It appears to "
  306.     "be quite heavy and unwieldy, but you seem to have no trouble with it.",
  307.     1000000, 0, 3, 0, 0, 0, 10, 15).
  308. ignore WeaponSell(r_armoury, "shield;enchanted",
  309.     "There is something magical about the enchanted shield. It is almost as "
  310.     "if some force within it wants to protect you.",
  311.     1000000, 25, 0, 0, 0, -5, 0, 0).
  312.  
  313. /* add a healer for fixing up players */
  314.  
  315. define tp_proving0 r_healer CreateThing(r_indoors).
  316. SetupRoom(r_healer, "in a healer's shop",
  317.     "The proprietor is a friendly-looking man wearing loose brown robes and "
  318.     "sandals. Shelves on one wall contain rows of neatly-labelled pottery "
  319.     "jars, and the back of this fairly large tent is filled with curtained "
  320.     "off areas containing simple cots. You can purchase healing here.").
  321. Connect(r_entrance, r_healer, D_SOUTH).
  322. UniConnect(r_healer, r_entrance, D_EXIT).
  323. AutoGraphics(r_healer, AutoOpenRoom).
  324. RoomName(r_healer, "Healer's", "Shop").
  325. r_healer@p_rNoMachines := true.
  326. Scenery(r_healer,
  327.     "proprietor,man;friendly-looking,friendly,looking."
  328.     "robe;loose,brown."
  329.     "sandal."
  330.     "shelves,shelf,wall."
  331.     "jar,pottery;pottery,neatly-labelled,neatly,labelled."
  332.     "curtains."
  333.     "cot,simple").
  334. HealSell(r_healer, "heal;minor.minor", 10, 6).
  335. HealSell(r_healer, "heal;small.small", 20, 15).
  336. HealSell(r_healer, "heal;medium.medium", 50, 40).
  337. HealSell(r_healer, "heal;large.large", 150, 140).
  338. HealSell(r_healer, "heal;great.great", 500, 500).
  339. r_healer@p_rBuyAction := HealingBuy.
  340.  
  341. /* and some more locations to play around in */
  342.  
  343. define tp_proving0 r_road1 CreateThing(r_provingRoad).
  344. SetupRoom(r_road1, "on an east-west cobbled road",
  345.     "Small alleys head north and south. There is a manhole in the middle of "
  346.     "the road.").
  347. Connect(r_entrance, r_road1, D_WEST).
  348. define tp_proving o_manholeCover CreateThing(nil).
  349. SetupObject(o_manholeCover, r_road1,
  350.     "cover,lid;manhole.manhole.hole;man", "").
  351. o_manholeCover@p_oInvisible := true.
  352. o_manholeCover@p_oNotGettable := true.
  353. define tp_proving0 PR_CROSSROADS_ID NextEffectId().
  354. define tp_proving0 proc crossRoadsDraw()void:
  355.  
  356.     if not KnowsEffect(nil, PR_CROSSROADS_ID) then
  357.     DefineEffect(nil, PR_CROSSROADS_ID);
  358.     GSetImage(nil, "pr_crossRoads");
  359.     IfFound(nil);
  360.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  361.     Else(nil);
  362.         AutoRoads();
  363.         GSetPen(nil, C_MEDIUM_GREY);
  364.         GAMove(nil, 80, 50);
  365.         GEllipse(nil, 5, 4, true);
  366.     Fi(nil);
  367.     EndEffect();
  368.     fi;
  369.     CallEffect(nil, PR_CROSSROADS_ID);
  370. corp;
  371. AutoGraphics(r_road1, crossRoadsDraw).
  372.  
  373. define tp_proving0 r_road2 CreateThing(r_provingRoad).
  374. SetupRoomP(r_road2, "at the west end of the proving grounds road",
  375.     "A small trail continues to the west. A simple wooden building is to the "
  376.     "north.").
  377. Connect(r_road1, r_road2, D_WEST).
  378. define tp_proving0 PR_ROAD2_ID NextEffectId().
  379. define tp_proving0 proc road2Draw()void:
  380.  
  381.     if not KnowsEffect(nil, PR_ROAD2_ID) then
  382.     DefineEffect(nil, PR_ROAD2_ID);
  383.     GSetImage(nil, "pr_road2");
  384.     IfFound(nil);
  385.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  386.     Else(nil);
  387.         GSetPen(nil, C_FOREST_GREEN);
  388.         GAMove(nil, 0, 0);
  389.         GRectangle(nil, 159, 99, true);
  390.         GSetPen(nil, C_TAN);
  391.         GAMove(nil, 80, 50);
  392.         GEllipse(nil, 15, 12, true);
  393.         GAMove(nil, 0, 46);
  394.         GRectangle(nil, 80, 8, true);
  395.         GAMove(nil, 80, 38);
  396.         GRectangle(nil, 79, 24, true);
  397.         GSetPen(nil, C_MEDIUM_BROWN);
  398.         GAMove(nil, 20, 0);
  399.         GRectangle(nil, 119, 33, true);
  400.         GSetPen(nil, C_BRICK_RED);
  401.         GAMove(nil, 75, 33);
  402.         HorizontalDoor();
  403.     Fi(nil);
  404.     EndEffect();
  405.     fi;
  406.     CallEffect(nil, PR_ROAD2_ID);
  407. corp;
  408. AutoGraphics(r_road2, road2Draw).
  409.  
  410. define tp_proving0 r_provingStore CreateThing(r_indoors).
  411. SetupRoom(r_provingStore, "in a store",
  412.     "This simple store isn't much to look at, but you can shop here for a "
  413.     "variety of useful goods.").
  414. Connect(r_road2, r_provingStore, D_NORTH).
  415. UniConnect(r_provingStore, r_road2, D_EXIT).
  416. AutoGraphics(r_provingStore, AutoOpenRoom).
  417. r_provingStore@p_rNoMachines := true.
  418. Scenery(r_provingStore, "store;simple.goods;variety,of,useful").
  419. MakeStore(r_provingStore).
  420. ignore WeaponSell(r_provingStore, "wrappings;fur",
  421.     "The fur wrappings can provide minimal protection from attacks with small "
  422.     "weapons, teeth and claws. They also provides an ideal nesting place for "
  423.     "many varieties of insect pests.",
  424.     25, 0, 0, 0, -1, 0, 0, 0).
  425. ignore WeaponSell(r_provingStore, "shield;hide",
  426.     "The hide shield is just a piece of tough animal hide fastened over a "
  427.     "light wooden frame. It provides some shielding from light weapons, and "
  428.     "can be used to deflect attacks.",
  429.     40, 0, 0, 0, 0, -1, 0, 0).
  430. define tp_proving0 o_flint AddForSale(r_provingStore, "lighter;flint.flint",
  431.     "The flint lighter is simply a small piece of flint with an iron striker "
  432.     "tied to it. The combination can be used to light things.",
  433.     10, nil).
  434.  
  435. define tp_proving0 proc buyOilLamp()status:
  436.     It()@p_oState := Parent(It())@p_oState;
  437.     continue
  438. corp;
  439. define tp_proving o_oilLamp AddForSale(r_provingStore, "lamp;oil", "",
  440.     100, buyOilLamp).
  441. define tp_proving0 proc oilLampDesc()string:
  442.     int timeLeft;
  443.     thing it;
  444.  
  445.     it := It();
  446.     timeLeft := it@p_oState;
  447.     "The oil lamp is made of tin. It is a small round container with a "
  448.     "wick on the top. The top can be removed to fill the lamp with oil. " +
  449.     if timeLeft = 0 then
  450.     "The lamp is currently empty."
  451.     elif timeLeft < 15 then
  452.     "The lamp is nearly empty."
  453.     else
  454.     if it@p_oLight then
  455.         "The lamp will continue to burn for about "
  456.     else
  457.         "The lamp currently has enough fuel for about "
  458.     fi +
  459.     if timeLeft >= 105 then
  460.         IntToString((timeLeft + 15) / 60) + " hours."
  461.     elif timeLeft >= 55 then
  462.         "an hour."
  463.     else
  464.         IntToString(timeLeft / 15 * 15) + " minutes."
  465.     fi
  466.     fi
  467. corp;
  468. o_oilLamp@p_oDescAction := oilLampDesc.
  469. o_oilLamp@p_oState := 5 * 60.    /* good for 5 hours of light */
  470. define tp_proving0 proc oilLampTick(thing lamp)void:
  471.     int newState;
  472.  
  473.     newState := lamp@p_oState - 1;
  474.     lamp@p_oState := newState;
  475.     if newState = 0 then
  476.     PassiveUnLightObject(lamp);
  477.     else
  478.     if newState < 10 then
  479.         if lamp@p_oCarryer ~= nil then
  480.         SPrint(lamp@p_oCarryer, "Your oil lamp flickers - "
  481.             "it is nearly out of oil!\n");
  482.         fi;
  483.     fi;
  484.     DoAfter(60, lamp, oilLampTick);
  485.     fi;
  486. corp;
  487. define tp_proving0 proc oilLampOn()status:
  488.     thing lamp;
  489.  
  490.     lamp := It();
  491.     if FindName(Me()@p_pCarrying, p_oName, "lighter;flint") = fail or
  492.     Parent(FindResult()) ~= o_flint
  493.     then
  494.     Print("You have no lighter to light the lamp with.\n");
  495.     fail
  496.     elif lamp@p_oState = 0 then
  497.     Print("The lamp is empty, you cannot light it.\n");
  498.     fail
  499.     elif lamp@p_oLight then
  500.     Print("The lamp is already lit.\n");
  501.     fail
  502.     else
  503.     ignore ActiveLightObject();
  504.     if lamp@p_oState = 1 then
  505.         Print("The lamp is virtually empty - it will not last long.\n");
  506.     elif lamp@p_oState <= 10 then
  507.         Print("The lamp is nearly empty - it will not last long.\n");
  508.     fi;
  509.     DoAfter(60, lamp, oilLampTick);
  510.     succeed
  511.     fi
  512. corp;
  513. o_oilLamp@p_oLightChecker := oilLampOn.
  514. define tp_proving0 proc oilLampOff()status:
  515.     status st;
  516.  
  517.     st := ActiveUnLightObject();
  518.     if st = succeed then
  519.     ignore CancelDoAfter(It(), oilLampTick);
  520.     succeed
  521.     else
  522.     st
  523.     fi
  524. corp;
  525. o_oilLamp@p_oExtinguishChecker := oilLampOff.
  526. define tp_proving0 proc oilLampPutIn(thing lamp, container)status:
  527.     if lamp@p_oLight then
  528.     Print("You'd better extinguish the lamp before putting it into the " +
  529.         FormatName(container@p_oName) + ".\n");
  530.     fail
  531.     else
  532.     continue
  533.     fi
  534. corp;
  535. o_oilLamp@p_oPutMeInChecker := oilLampPutIn.
  536.  
  537. define tp_proving0 proc refillBuy()status:
  538.     thing me, lamp;
  539.  
  540.     me := Me();
  541.     if FindName(me@p_pCarrying, p_oName, "lamp;oil") = fail then
  542.     lamp := nil;
  543.     else
  544.     lamp := FindResult();
  545.     if Parent(lamp) ~= o_oilLamp then
  546.         lamp := nil;
  547.     fi;
  548.     fi;
  549.     if lamp = nil then
  550.     Print("You have no oil lamp to refill.\n");
  551.     fail
  552.     else
  553.     lamp -- p_oState;
  554.     Print("Your lamp is now refilled.\n");
  555.     if not me@p_pHidden then
  556.         OPrint(me@p_pName + "'s lamp has been refilled.\n");
  557.     fi;
  558.     succeed
  559.     fi
  560. corp;
  561. define tp_proving o_refill AddForSale(r_provingStore, "refill;oil,lamp",
  562.     "", 25, refillBuy).
  563.  
  564. define tp_proving0 o_oilCan AddForSale(r_provingStore,
  565.     "oil;can,of.oilcan.oil-can.can", "", 100, nil).
  566. define tp_proving0 proc oilCanDesc()string:
  567.     int oilLeft;
  568.  
  569.     oilLeft := It()@p_oState;
  570.     if oilLeft = 0 then
  571.     "The oil can is empty."
  572.     elif oilLeft = 1 then
  573.     "The oil can has enough oil for one more lamp refill."
  574.     else
  575.     "The can of oil is a small tin container with a pouring spout. It has "
  576.     "enough oil in it for about " + IntToString(oilLeft) +
  577.     " refills of an oil lamp."
  578.     fi
  579. corp;
  580. o_oilCan@p_oDescAction := oilCanDesc.
  581. o_oilCan@p_oState := 5.
  582. define tp_proving0 proc oilCanDrop(thing can)status:
  583.     if can@p_oState = 0 then
  584.     if LightAt(Here()) then
  585.         if can@p_oCarryer = Me() then
  586.         Print("You discard the empty oil can. It vanishes in a puff "
  587.             "of neatness.\n");
  588.         fi;
  589.         OPrint(FormatName(Me()@p_pName) + " discards an empty oil can.\n");
  590.     fi;
  591.     ClearThing(can);
  592.     DelElement(Me()@p_pCarrying, can);
  593.     succeed
  594.     else
  595.     continue
  596.     fi
  597. corp;
  598. o_oilCan@p_oDropChecker := oilCanDrop.
  599. define tp_proving0 proc oilLampFillWith(thing lamp, source)status:
  600.     int oilLeft;
  601.  
  602.     if Parent(source) = o_oilCan then
  603.     oilLeft := source@p_oState;
  604.     if oilLeft = 0 then
  605.         Print("The oil can is empty.\n");
  606.         succeed
  607.     else
  608.         lamp -- p_oState;    /* inherit full time from parent */
  609.         oilLeft := oilLeft - 1;
  610.         source@p_oState := oilLeft;
  611.         if oilLeft = 0 then
  612.         Print("You fill the lamp, but the oil can is now empty.\n");
  613.         succeed
  614.         else
  615.         continue
  616.         fi
  617.     fi
  618.     else
  619.     fail
  620.     fi
  621. corp;
  622. o_oilLamp@p_oFillMeWithChecker := oilLampFillWith.
  623.  
  624. define tp_proving proc buyTorch()status:
  625.     It()@p_oState := Parent(It())@p_oState;
  626.     continue
  627. corp;
  628. define tp_proving o_torch AddForSale(r_provingStore, "torch;reed", "",
  629.     5, buyTorch).
  630. define tp_proving0 proc torchDesc()string:
  631.     int timeLeft;
  632.  
  633.     timeLeft := It()@p_oState;
  634.     if timeLeft = 0 then
  635.     "The torch is completely burned out."
  636.     else
  637.     "The reed torch is a simple bundle of dried reeds tied together, its "
  638.     "top coated with pitch. " +
  639.     if It()@p_oLight then
  640.         "It will continue to burn brightly for about "
  641.     else
  642.         "Although not now lit, it will burn brightly for about "
  643.     fi +
  644.     if timeLeft = 1 then
  645.         "one more minute."
  646.     else
  647.         IntToString(timeLeft) + " minutes."
  648.     fi
  649.     fi
  650. corp;
  651. o_torch@p_oDescAction := torchDesc.
  652. o_torch@p_oState := 10.
  653. define tp_proving0 proc torchTick(thing torch)void:
  654.     int newState;
  655.  
  656.     newState := torch@p_oState - 1;
  657.     torch@p_oState := newState;
  658.     if newState = 0 then
  659.     PassiveUnLightObject(torch);
  660.     else
  661.     if newState < 3 then
  662.         if torch@p_oCarryer ~= nil then
  663.         SPrint(torch@p_oCarryer, "Your torch splutters - "
  664.             "it is nearly burned out!\n");
  665.         fi;
  666.     fi;
  667.     DoAfter(60, torch, torchTick);
  668.     fi;
  669. corp;
  670. define tp_proving0 proc torchOn()status:
  671.     thing torch;
  672.  
  673.     torch := It();
  674.     if FindName(Me()@p_pCarrying, p_oName, "lighter;flint") = fail or
  675.     Parent(FindResult()) ~= o_flint
  676.     then
  677.     Print("You have no lighter to light the torch with.\n");
  678.     fail
  679.     elif torch@p_oState = 0 then
  680.     Print("The torch is burned out, you cannot light it.\n");
  681.     fail
  682.     elif torch@p_oLight then
  683.     Print("The torch is already lit.\n");
  684.     fail
  685.     else
  686.     ignore ActiveLightObject();
  687.     if torch@p_oState = 1 then
  688.         Print("The torch is virtually gone - it will not last long.\n");
  689.     elif torch@p_oState <= 3 then
  690.         Print("The torch is nearly gone - it will not last long.\n");
  691.     fi;
  692.     DoAfter(60, torch, torchTick);
  693.     succeed
  694.     fi
  695. corp;
  696. o_torch@p_oLightChecker := torchOn.
  697. define tp_proving0 proc torchOff()status:
  698.     status st;
  699.  
  700.     st := ActiveUnLightObject();
  701.     if st = succeed then
  702.     ignore CancelDoAfter(It(), torchTick);
  703.     succeed
  704.     else
  705.     st
  706.     fi
  707. corp;
  708. o_torch@p_oExtinguishChecker := torchOff.
  709. define tp_proving0 proc torchDrop(thing torch)status:
  710.     if torch@p_oState = 0 then
  711.     if LightAt(Here()) then
  712.         if torch@p_oCarryer = Me() then
  713.         Print("You discard the burned-out torch. It vanishes in a "
  714.             "puff of neatness.\n");
  715.         fi;
  716.         OPrint(FormatName(Me()@p_pName) +
  717.         " discards a burned out torch.\n");
  718.     fi;
  719.     ClearThing(torch);
  720.     DelElement(Me()@p_pCarrying, torch);
  721.     succeed
  722.     else
  723.     continue
  724.     fi
  725. corp;
  726. o_torch@p_oDropChecker := torchDrop.
  727. define tp_proving0 proc torchPutIn(thing torch, container)status:
  728.     if torch@p_oLight then
  729.     Print("You'd better extinguish the torch before putting it into the " +
  730.         FormatName(container@p_oName) + ".\n");
  731.     fail
  732.     else
  733.     continue
  734.     fi
  735. corp;
  736. o_torch@p_oPutMeInChecker := torchPutIn.
  737.  
  738. define tp_proving o_sack AddForSale(r_provingStore, "sack;canvas",
  739.     "The canvas sack is strong and reliable, but not very large.", 10, nil).
  740. o_sack@p_oContents := CreateThingList().
  741. o_sack@p_oCapacity := 5.
  742.  
  743. define tp_proving0 r_alley1 CreateThing(r_provingRoad).
  744. SetupRoom(r_alley1, "in a north-south alley",
  745.     "Piles of rusted metal, moldy leather and rotted wood litter the side "
  746.     "of the armoury tent, which is even dirtier on this side than on the "
  747.     "front. Across the alley from it is the remains of another tent, which "
  748.     "burned down long ago.").
  749. Connect(r_road1, r_alley1, D_NORTH).
  750. Scenery(r_alley1,
  751.     "metal;piles,of,rusted."
  752.     "leather;moldy."
  753.     "wood;rotted."
  754.     "litter."
  755.     "tent;dirty,armoury."
  756.     "tent,remains;burned,tent.").
  757.  
  758. define tp_proving r_alley2 CreateThing(r_provingRoad).
  759. SetupRoomP(r_alley2, "at the north end of an alley",
  760.     "The alley ends here, although you can duck around the armoury "
  761.     "to the east, and a path heads north to a pasture. "
  762.     "There is a large drainage grate in the ground.").
  763. Connect(r_alley1, r_alley2, D_NORTH).
  764. UniConnect(r_alley2, r_entrance, D_EAST).
  765. define tp_proving0 PR_ALLEY2_ID NextEffectId().
  766. define tp_proving0 proc alley2Draw()void:
  767.  
  768.     if not KnowsEffect(nil, PR_ALLEY2_ID) then
  769.     DefineEffect(nil, PR_ALLEY2_ID);
  770.     GSetImage(nil, "pr_alley2");
  771.     IfFound(nil);
  772.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  773.     Else(nil);
  774.         GSetPen(nil, C_FOREST_GREEN);
  775.         GAMove(nil, 0, 0);
  776.         GRectangle(nil, 159, 99, true);
  777.         GSetPen(nil, C_TAN);
  778.         GAMove(nil, 80, 50);
  779.         GEllipse(nil, 15, 12, true);
  780.         GAMove(nil, 65, 50);
  781.         GRectangle(nil, 30, 49, true);
  782.         GAMove(nil, 75, 0);
  783.         GRectangle(nil, 10, 50, true);
  784.         GAMove(nil, 80, 46);
  785.         GRectangle(nil, 79, 8, true);
  786.     Fi(nil);
  787.     EndEffect();
  788.     fi;
  789.     CallEffect(nil, PR_ALLEY2_ID);
  790. corp;
  791. AutoGraphics(r_alley2, alley2Draw).
  792.  
  793. define tp_proving0 r_gateSouth CreateThing(r_provingField).
  794. SetupRoom(r_gateSouth, "just outside the pasture",
  795.     "Immediately to your north is a gate into the pasture. The gate is wide "
  796.     "open, but the fence running east-west is quite sturdy.").
  797. Connect(r_alley2, r_gateSouth, D_NORTH).
  798. AutoGraphics(r_gateSouth, AutoPaths).
  799. AutoPens(r_gateSouth, C_FOREST_GREEN, C_TAN, 0, 0).
  800. RoomName(r_gateSouth, "Outside", "Pasture").
  801. Scenery(r_gateSouth, "gate.fence").
  802.  
  803. define tp_proving0 r_pasture CreateThing(r_field).
  804. AutoGraphics(r_pasture, AutoOpenSpace).
  805. SetThingStatus(r_pasture, ts_readonly).
  806. monsterSetP(r_pasture).
  807.  
  808. define tp_proving0 r_gateNorth CreateThing(r_pasture).
  809. SetupRoom(r_gateNorth, "just inside the pasture",
  810.     "The gate in the fence is to your south, and the pasture is all around "
  811.     "you.").
  812. Connect(r_gateSouth, r_gateNorth, D_NORTH).
  813. Scenery(r_gateNorth, "gate.fence").
  814.  
  815. define tp_proving0 r_pasture1 CreateThing(r_pasture).
  816. SetupRoom(r_pasture1, "in the pasture", "The fence is to the south.").
  817. Connect(r_gateNorth, r_pasture1, D_EAST).
  818. Scenery(r_pasture1, "fence").
  819.  
  820. define tp_proving0 r_pasture2 CreateThing(r_pasture).
  821. SetupRoom(r_pasture2, "in the south-east corner of the pasture",
  822.     "The fence prevents you from going further east or further south.").
  823. Connect(r_pasture1, r_pasture2, D_EAST).
  824. Scenery(r_pasture2, "fence").
  825.  
  826. define tp_proving0 r_pasture3 CreateThing(r_pasture).
  827. SetupRoom(r_pasture3, "in the pasture", "The fence is to the east.").
  828. Connect(r_pasture2, r_pasture3, D_NORTH).
  829. Connect(r_pasture1, r_pasture3, D_NORTHEAST).
  830. Scenery(r_pasture3, "fence").
  831.  
  832. define tp_proving0 r_pasture4 CreateThing(r_pasture).
  833. SetupRoom(r_pasture4, "in the pasture", "There is a bog to the north.").
  834. Connect(r_pasture3, r_pasture4, D_WEST).
  835. Connect(r_pasture1, r_pasture4, D_NORTH).
  836. Connect(r_gateNorth, r_pasture4, D_NORTHEAST).
  837. Connect(r_pasture2, r_pasture4, D_NORTHWEST).
  838. Scenery(r_pasture4, "bog").
  839.  
  840. define tp_proving0 o_cowpie CreateThing(nil).
  841. SetupObject(o_cowpie, r_pasture4, "pie;cow.cow-pie.dung",
  842.     "The cow pie looks to be a few days old - it is dry on the surface, but "
  843.     "you can see moisture further in. Closer investigation is not warranted.").
  844. define tp_proving0 proc getCowPie(thing th)status:
  845.     Print("YUCK!!! You'd need a sooper dooper pooper scooper to pick up the "
  846.       "cow pie!\n");
  847.     succeed
  848. corp;
  849. o_cowpie@p_oGetChecker := getCowPie.
  850.  
  851. define tp_proving0 r_pasture5 CreateThing(r_pasture).
  852. SetupRoom(r_pasture5, "in the pasture", "There is a bog to the north.").
  853. Connect(r_pasture4, r_pasture5, D_WEST).
  854. Connect(r_gateNorth, r_pasture5, D_NORTH).
  855. Connect(r_pasture1, r_pasture5, D_NORTHWEST).
  856. Scenery(r_pasture5, "bog").
  857.  
  858. define tp_proving0 r_pasture6 CreateThing(r_pasture).
  859. SetupRoom(r_pasture6, "in the pasture", "There is a bog to the north.").
  860. Connect(r_pasture5, r_pasture6, D_WEST).
  861. Connect(r_gateNorth, r_pasture6, D_NORTHWEST).
  862. Scenery(r_pasture6, "bog").
  863.  
  864. define tp_proving0 r_pasture7 CreateThing(r_pasture).
  865. SetupRoom(r_pasture7, "in the pasture", "The fence is to the south.").
  866. Connect(r_pasture6, r_pasture7, D_SOUTH).
  867. Connect(r_gateNorth, r_pasture7, D_WEST).
  868. Connect(r_pasture5, r_pasture7, D_SOUTHWEST).
  869. Scenery(r_pasture7, "fence").
  870.  
  871. define tp_proving0 r_pasture8 CreateThing(r_pasture).
  872. SetupRoomP(r_pasture8, "in the south-west corner of the pasture",
  873.     "Fences keep your from going further south or west.").
  874. Connect(r_pasture7, r_pasture8, D_WEST).
  875. Connect(r_pasture6, r_pasture8, D_SOUTHWEST).
  876. Scenery(r_pasture8, "fence.hedge").
  877.  
  878. define tp_proving0 r_pasture9 CreateThing(r_pasture).
  879. SetupRoomP(r_pasture9, "in the pasture by the fence", "").
  880. Connect(r_pasture8, r_pasture9, D_NORTH).
  881. Connect(r_pasture6, r_pasture9, D_WEST).
  882. Connect(r_pasture7, r_pasture9, D_NORTHWEST).
  883. Scenery(r_pasture9, "hedge").
  884.  
  885. define tp_proving0 r_pasture10 CreateThing(r_pasture).
  886. SetupRoomP(r_pasture10, "in the pasture",
  887.     "A narrow spit of solid ground heads out into the bog to the east.").
  888. Connect(r_pasture9, r_pasture10, D_NORTH).
  889. Scenery(r_pasture10, "hedge.bog.ground;narrow,spit,of,solid").
  890.  
  891. define tp_proving0 r_pasture11 CreateThing(r_pasture).
  892. SetupRoomP(r_pasture11, "on a spit of land in the bog",
  893.     "Safe ground leads to the west.").
  894. Connect(r_pasture10, r_pasture11, D_EAST).
  895. Scenery(r_pasture11, "bog").
  896.  
  897. define tp_proving0 r_pasture12 CreateThing(r_pasture).
  898. SetupRoom(r_pasture12, "in the pasture",
  899.     "The fence is to the east and the bog is to the west.").
  900. Connect(r_pasture3, r_pasture12, D_NORTH).
  901. Scenery(r_pasture12, "fence.bog").
  902.  
  903. define tp_proving0 r_pasture13 CreateThing(r_pasture).
  904. SetupRoom(r_pasture13, "in the pasture",
  905.     "The fence is to the east and the bog is to the west.").
  906. Connect(r_pasture12, r_pasture13, D_NORTH).
  907. Scenery(r_pasture13, "fence.bog").
  908.  
  909. define tp_proving0 r_pasture14 CreateThing(r_pasture).
  910. SetupRoom(r_pasture14, "in the north-east corner of the pasture",
  911.     "Fences prevent further progress north or east.").
  912. Connect(r_pasture13, r_pasture14, D_NORTH).
  913. Scenery(r_pasture14, "fence.bog").
  914.  
  915. define tp_proving0 r_pasture15 CreateThing(r_pasture).
  916. SetupRoom(r_pasture15, "in the pasture",
  917.     "The fence is to the north and the bog is to the south.").
  918. Connect(r_pasture14, r_pasture15, D_WEST).
  919. Scenery(r_pasture15, "fence.bog").
  920.  
  921. define tp_proving0 r_pasture16 CreateThing(r_pasture).
  922. SetupRoom(r_pasture16, "in the pasture", "The fence is to the north.").
  923. Connect(r_pasture15, r_pasture16, D_WEST).
  924. Scenery(r_pasture16, "fence").
  925.  
  926. define tp_proving0 r_pasture17 CreateThing(r_pasture).
  927. SetupRoomP(r_pasture17, "in the pasture",
  928.     "The fence is to the north and the bog is both west and south.").
  929. Connect(r_pasture16, r_pasture17, D_WEST).
  930. Scenery(r_pasture17, "fence.bog").
  931.  
  932. /* For the next little while is the apple tree, which can do healing. */
  933.  
  934. define tp_proving0 p_pAppleEatCount CreateIntProp().
  935. define tp_proving0 p_pAppleEatTime CreateIntProp().
  936.  
  937. define tp_proving0 r_pasture18 CreateThing(r_pasture).
  938. SetupRoom(r_pasture18, "in the pasture",
  939.     "The bog is everywhere except north. There is a fine apple tree here, "
  940.     "loaded with juicy red apples.").
  941. Connect(r_pasture16, r_pasture18, D_SOUTH).
  942. Scenery(r_pasture18, "bog").
  943.  
  944. define tp_proving0 o_appleTree CreateThing(nil).
  945. SetupObject(o_appleTree, r_pasture18, "tree;fine,apple",
  946.     "The tree is only medium sized, but holds an impressive quantity of "
  947.     "apples, many of which are in easy reach.").
  948. o_appleTree@p_oInvisible := true.
  949. o_appleTree@p_oSmellString := "The apple tree smells somewhat woody.".
  950.  
  951. define tp_proving0 o_appleOnTree CreateThing(nil).
  952. SetupObject(o_appleOnTree, r_pasture18, "apple;juicy,red",
  953.     "The apples on the tree look quite delicious.").
  954. o_appleOnTree@p_oInvisible := true.
  955. o_appleOnTree@p_oEatString := "You should pick an apple from the tree first.".
  956. o_appleOnTree@p_oSmellString := o_appleOnTree@p_oEatString.
  957. o_appleOnTree@p_oTouchString := o_appleOnTree@p_oEatString.
  958.  
  959. define tp_proving0 proc appleDrop(thing apple)status:
  960.     thing carryer, here;
  961.  
  962.     carryer := apple@p_oCarryer;
  963.     ClearThing(apple);
  964.     SPrint(carryer, "The apple drops and is pulped!\n");
  965.     here := Here();
  966.     if CanSee(here, carryer) and not carryer@p_pHidden then
  967.     ABPrint(here, carryer, carryer, FormatName(carryer@p_pName) +
  968.         " drops an apple which is pulped.\n");
  969.     else
  970.     ABPrint(here, carryer, carryer, "You hear a smack! sound.\n");
  971.     fi;
  972.     DelElement(carryer@p_pCarrying, apple);
  973.     /* we have just destroyed the apple and already dropped it, we do NOT
  974.        want to continue with normal drop processing */
  975.     succeed
  976. corp;
  977.  
  978. define tp_proving0 proc appleEat()status:
  979.     thing th, me;
  980.     int now, current, max;
  981.  
  982.     th := It();
  983.     me := Me();
  984.     if th@p_oCreator = me then
  985.     now := Time();
  986.     if now - me@p_pAppleEatTime > 60 * 60 then
  987.         me@p_pAppleEatCount := 0;
  988.     fi;
  989.     if me@p_pAppleEatCount >= 3 then
  990.         Print("You'd better not eat any more apples for a while. Too many "
  991.         "of them will make you sick!\n");
  992.         fail
  993.     else
  994.         Print("You eat the apple. It was really good.\n");
  995.         current := me@p_pHitNow;
  996.         max := me@p_pHitMax;
  997.         if current ~= max then
  998.         current := current + Random(5) + 5;
  999.         if current > max then
  1000.             current := max;
  1001.         fi;
  1002.         me@p_pHitNow := current;
  1003.         fi;
  1004.         if CanSee(Here(), me) and not me@p_pHidden then
  1005.         OPrint(FormatName(me@p_pName) + " eats an apple.\n");
  1006.         else
  1007.         OPrint("You hear some crunching noises.\n");
  1008.         fi;
  1009.         ClearThing(th);
  1010.         DelElement(me@p_pCarrying, th);
  1011.         if me@p_pAppleEatCount = 0 then
  1012.         me@p_pAppleEatCount := 1;
  1013.         me@p_pAppleEatTime := now;
  1014.         else
  1015.         me@p_pAppleEatCount := me@p_pAppleEatCount + 1;
  1016.         fi;
  1017.         succeed
  1018.     fi
  1019.     else
  1020.     Print("That's not your apple!\n");
  1021.     succeed
  1022.     fi
  1023. corp;
  1024.  
  1025. define tp_proving0 proc appleGive(thing target)status:
  1026.     thing me, apple;
  1027.  
  1028.     me := Me();
  1029.     apple := It();
  1030.     if apple@p_oCreator = me then
  1031.     Print("You fumble when trying to give away the apple, and drop it!\n");
  1032.     if CanSee(Here(), me) and not me@p_pHidden then
  1033.         OPrint(FormatName(me@p_pName) +
  1034.         " drops an apple which is pulped.\n");
  1035.     else
  1036.         OPrint("You hear a smack! sound.\n");
  1037.     fi;
  1038.     ClearThing(apple);
  1039.     DelElement(me@p_pCarrying, apple);
  1040.     else
  1041.     Print("That's not your apple!\n");
  1042.     fi;
  1043.     /* the give never works */
  1044.     fail
  1045. corp;
  1046.  
  1047. define tp_proving0 o_appleInHand CreateThing(nil).
  1048. o_appleInHand@p_oName := "apple;juicy,red".
  1049. o_appleInHand@p_oDesc := "The apple looks quite delicious!".
  1050. o_appleInHand@p_oEatChecker := appleEat.
  1051. o_appleInHand@p_oDropChecker := appleDrop.
  1052. o_appleInHand@p_oGiveChecker := appleGive.
  1053. o_appleInHand@p_oSmellString := "The apple smells like an apple.".
  1054. o_appleInHand@p_oTouchString := "Surprise! The apple feels like an apple.".
  1055. SetThingStatus(o_appleInHand, ts_wizard).
  1056.  
  1057. define tp_proving0 proc appleGet(thing th)status:
  1058.     thing me;
  1059.  
  1060.     me := Me();
  1061.     if FindName(me@p_pCarrying, p_oName, "apple;juicy,red") ~= fail then
  1062.     Print("Don't be greedy! You already have an apple.\n");
  1063.     else
  1064.     /* will be owned by the real player */
  1065.     th := CreateThing(o_appleInHand);
  1066.     th@p_oCreator := me;
  1067.     SetThingStatus(th, ts_public);
  1068.     if CarryItem(th) then
  1069.         Print("You pick an apple from the tree.\n");
  1070.         /* assume it is not dark */
  1071.         if not me@p_pHidden then
  1072.         OPrint(FormatName(me@p_pName) +
  1073.                " picks an apple from the tree.\n");
  1074.         fi;
  1075.     else
  1076.         ClearThing(th);
  1077.     fi;
  1078.     fi;
  1079.     /* do not want to continue with normal get processing */
  1080.     succeed
  1081. corp;
  1082.  
  1083. o_appleOnTree@p_oGetChecker := appleGet.
  1084.  
  1085. define tp_proving0 proc appleTreeGet(thing th)status:
  1086.     Print("The tree is far too large for you to carry, and in any event, "
  1087.         "it is securely rooted to the ground.\n");
  1088.     if Me()@p_pHidden then
  1089.     OPrint("The tree shakes slightly.\n");
  1090.     else
  1091.     OPrint(FormatName(Me()@p_pName) +
  1092.            " seems to be embracing the tree.\n");
  1093.     fi;
  1094.     succeed
  1095. corp;
  1096.  
  1097. o_appleTree@p_oGetChecker := appleTreeGet.
  1098.  
  1099. /* Note that we do NOT prevent people from getting several apples and putting
  1100. them in containers. */
  1101.  
  1102. /* End of apple tree stuff */
  1103.  
  1104. define tp_proving0 r_alley3 CreateThing(r_provingRoad).
  1105. SetupRoom(r_alley3, "in an alley",
  1106.     "The alley runs north-south between the healer's tent and a vacant spot.").
  1107. Connect(r_road1, r_alley3, D_SOUTH).
  1108. Scenery(r_alley3, "tent;healer's,healer.spot;vacant").
  1109.  
  1110. define tp_proving r_alley4 CreateThing(r_provingRoad).
  1111. SetupRoom(r_alley4, "at the south end of an alley",
  1112.     "You can go behind the healer's tent to the east, and a trail continues "
  1113.     "south. A vacant spot is west. There is a large drainage grate in the "
  1114.     "ground.").
  1115. Connect(r_alley3, r_alley4, D_SOUTH).
  1116. Scenery(r_alley4, "tent;healer's,healer.spot;vacant").
  1117. define tp_proving0 PR_ALLEY4_ID NextEffectId().
  1118. define tp_proving0 proc alley4Draw()void:
  1119.  
  1120.     if not KnowsEffect(nil, PR_ALLEY4_ID) then
  1121.     DefineEffect(nil, PR_ALLEY4_ID);
  1122.     GSetImage(nil, "pr_alley4");
  1123.     IfFound(nil);
  1124.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  1125.     Else(nil);
  1126.         GSetPen(nil, C_FOREST_GREEN);
  1127.         GAMove(nil, 0, 0);
  1128.         GRectangle(nil, 159, 99, true);
  1129.         GSetPen(nil, C_TAN);
  1130.         GAMove(nil, 80, 50);
  1131.         GEllipse(nil, 15, 12, true);
  1132.         GAMove(nil, 65, 0);
  1133.         GRectangle(nil, 30, 50, true);
  1134.         GAMove(nil, 80, 46);
  1135.         GRectangle(nil, 79, 8, true);
  1136.         GAMove(nil, 75, 50);
  1137.         GRectangle(nil, 10, 49, true);
  1138.     Fi(nil);
  1139.     EndEffect();
  1140.     fi;
  1141.     CallEffect(nil, PR_ALLEY4_ID);
  1142. corp;
  1143. AutoGraphics(r_alley4, alley4Draw).
  1144.  
  1145. define tp_proving0 r_behindHealer CreateThing(r_provingRoad).
  1146. SetupRoom(r_behindHealer, "behind the healer's tent",
  1147.     "Even back here the tent is quite clean, and the garbage, consisting of "
  1148.     "empty clay jugs, small skeletons and assorted unrecognizeable objects, "
  1149.     "is piled neatly in several wooden bins. "
  1150.     "The alley is west and you can slip around the tent to the east.").
  1151. Connect(r_alley4, r_behindHealer, D_EAST).
  1152. UniConnect(r_behindHealer, r_entrance, D_EAST).
  1153. RoomName(r_behindHealer, "Behind", "Healer's").
  1154. Scenery(r_behindHealer,
  1155.     "tent;clean,healer's,healer."
  1156.     "garbage."
  1157.     "jug;empty,clay."
  1158.     "skeleton;small."
  1159.     "object;assorted,unrecognizeable."
  1160.     "bin;wooden,wood").
  1161. AutoGraphics(r_behindHealer, AutoPaths).
  1162. AutoPens(r_behindHealer, C_FOREST_GREEN, C_TAN, 0, 0).
  1163.  
  1164. define tp_proving0 r_fTrail0 CreateThing(r_provingField).
  1165. SetupRoomP(r_fTrail0, "at a north and west bend in the trail", "").
  1166. Connect(r_alley4, r_fTrail0, D_SOUTH).
  1167. AutoGraphics(r_fTrail0, AutoPaths).
  1168.  
  1169. define tp_proving0 r_fTrail1 CreateThing(r_provingField).
  1170. SetupRoomP(r_fTrail1, "on an east-west trail",
  1171.     "You can see forest to the west.").
  1172. Connect(r_fTrail0, r_fTrail1, D_WEST).
  1173. AutoGraphics(r_fTrail1, AutoPaths).
  1174.  
  1175. define tp_proving0 r_forest1 CreateThing(r_provingForest).
  1176. SetupRoomP(r_forest1, "in a forest",
  1177.     "You can see open space to the east, and paths in several directions.").
  1178. Connect(r_fTrail1, r_forest1, D_WEST).
  1179.  
  1180. define tp_proving0 r_forest2 CreateThing(r_provingForest).
  1181. SetupRoomP(r_forest2, "in a forest",
  1182.     "You can skirt around a hill to the northwest and go straight south.").
  1183. Connect(r_forest1, r_forest2, D_NORTH).
  1184. Scenery(r_forest2, "hill").
  1185. define tp_proving0 PR_FOREST2_ID NextEffectId().
  1186. define tp_proving0 proc forest2Draw()void:
  1187.  
  1188.     if not KnowsEffect(nil, PR_FOREST2_ID) then
  1189.     DefineEffect(nil, PR_FOREST2_ID);
  1190.     GSetImage(nil, "pr_forest2");
  1191.     IfFound(nil);
  1192.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  1193.     Else(nil);
  1194.         AutoPaths();
  1195.         GSetPen(nil, C_MEDIUM_BROWN);
  1196.         GPolygonStart(nil);
  1197.         GAMove(nil, 25, 0);
  1198.         GRDraw(nil, 45, 30);
  1199.         GRDraw(nil, 20, 0);
  1200.         GRDraw(nil, 45, -30);
  1201.         GPolygonEnd(nil);
  1202.     Fi(nil);
  1203.     EndEffect();
  1204.     fi;
  1205.     CallEffect(nil, PR_FOREST2_ID);
  1206. corp;
  1207. AutoGraphics(r_forest2, forest2Draw).
  1208.  
  1209. define tp_proving0 r_forest3 CreateThing(r_provingForest).
  1210. SetupRoomP(r_forest3, "in a forest beside a stream",
  1211.     "The stream blocks further progress to the west, but you can go "
  1212.     "northeast and north.").
  1213. Connect(r_forest1, r_forest3, D_SOUTHWEST).
  1214. define tp_proving0 o_stream CreateThing(nil).
  1215. SetupObject(o_stream, r_forest3, "water.stream.creek.brook", "").
  1216. o_stream@p_oInvisible := true.
  1217. o_stream@p_oNotGettable := true.
  1218. define tp_proving0 proc streamDrink()status:
  1219.     thing me;
  1220.     int current, max;
  1221.  
  1222.     me := Me();
  1223.     if not me@p_pHidden then
  1224.     OPrint(FormatName(me@p_pName) + " takes a drink from the stream.\n");
  1225.     else
  1226.     OPrint("You hear a slurping sound.\n");
  1227.     fi;
  1228.     Print("Ahh! That was very refreshing!\n");
  1229.     current := me@p_pHitNow;
  1230.     max := me@p_pHitMax;
  1231.     if current ~= max then
  1232.     current := current + Random(3) + 2;
  1233.     if current > max then
  1234.         current := max;
  1235.     fi;
  1236.     me@p_pHitNow := current;
  1237.     fi;
  1238.     succeed
  1239. corp;
  1240. o_stream@p_oEatChecker := streamDrink.
  1241. define tp_proving0 o_drink CreateThing(nil).
  1242. SetupObject(o_drink, r_forest3, "drink.swallow", "").
  1243. o_drink@p_oInvisible := true.
  1244. define tp_proving0 proc takeDrink(thing drink)status:
  1245.     streamDrink()
  1246. corp;
  1247. o_drink@p_oGetChecker := takeDrink.
  1248. define tp_proving0 proc streamDraw()void:
  1249.  
  1250.     AutoPaths();
  1251.     GSetPen(nil, C_BLUE);
  1252.     GAMove(nil, 40, 0);
  1253.     GRectangle(nil, 20, 99, true);
  1254. corp;
  1255. AutoGraphics(r_forest3, streamDraw).
  1256. RoomName(r_forest3, "Forest", "").
  1257.  
  1258. define tp_proving0 r_forest4 CreateThing(r_provingForest).
  1259. SetupRoomP(r_forest4, "in a forest beside a stream",
  1260.     "The stream blocks further progress to the west, but you can go "
  1261.     "north, south, and east.").
  1262. Connect(r_forest1, r_forest4, D_WEST).
  1263. Connect(r_forest3, r_forest4, D_NORTH).
  1264. AddTail(r_forest4@p_rContents, o_stream).
  1265. AddTail(r_forest4@p_rContents, o_drink).
  1266. AutoGraphics(r_forest4, streamDraw).
  1267. RoomName(r_forest4, "Forest", "").
  1268.  
  1269. define tp_proving r_forestByStream CreateThing(r_provingForest).
  1270. SetupRoomP(r_forestByStream, "down by the stream in the forest",
  1271.     "There is a large sewer draining into the stream here. The trickle of "
  1272.     "water coming from it manages to not pollute the stream. An iron grating "
  1273.     "covers the entrance to the sewer. You can climb up the bank to the "
  1274.     "trail.").
  1275. Connect(r_forest4, r_forestByStream, D_DOWN).
  1276. AddTail(r_forestByStream@p_rContents, o_stream).
  1277. AddTail(r_forestByStream@p_rContents, o_drink).
  1278. AutoGraphics(r_forestByStream, streamDraw).
  1279. RoomName(r_forestByStream, "Down By", "Stream").
  1280. Scenery(r_forestByStream,
  1281.     "trickle.bank.stonework.stone.work;stone.mouth;tunnel.tunnel."
  1282.     "sewer;large").
  1283. define tp_proving o_barGrating CreateThing(nil).
  1284. SetupObject(o_barGrating, r_forestByStream, "grating;iron,bar.bar;iron.iron",
  1285.     "The grating is solidly built, and is firmly mounted into stonework "
  1286.     "around the tunnel mouth. It appears to be held closed by some "
  1287.     "kind of latch mechanism.").
  1288. o_barGrating@p_oInvisible := true.
  1289. o_barGrating@p_oNotLocked := true.
  1290. define tp_proving proc barGratingGet(thing it)status:
  1291.     Print("The grating is held quite firmly in the stonework - you cannot "
  1292.     "break it free.\n");
  1293.     OPrint(Me()@p_pName + " rattles the grating.\n");
  1294.     fail
  1295. corp;
  1296. o_barGrating@p_oGetChecker := barGratingGet.
  1297. o_barGrating@p_oOpenString :=
  1298.     "The grating is held closed by the latch mechanism.".
  1299. define tp_proving o_gratingLatch CreateThing(nil).
  1300. SetupObject(o_gratingLatch, r_forestByStream, "mechanism;latch.latch",
  1301.     "The mechanism is quite simple. It can be released by pulling on it, "
  1302.     "but it appears that it will latch again as soon as it is released.").
  1303. o_gratingLatch@p_oInvisible := true.
  1304. o_gratingLatch@p_oNotLocked := true.
  1305. define tp_proving proc gratingLatchGet(thing it)status:
  1306.     Print("The latch mechanism is part of the grating - "
  1307.     "you cannot remove it.\n");
  1308.     OPrint(Me()@p_pName + " fiddles with the grating.\n");
  1309.     fail
  1310. corp;
  1311. o_gratingLatch@p_oGetChecker := gratingLatchGet.
  1312.  
  1313. define tp_proving0 r_forest5 CreateThing(r_provingForest).
  1314. SetupRoomP(r_forest5, "in a forest beside a stream",
  1315.     "The stream blocks further progress to the west, but you can go "
  1316.     "north, south and southeast.").
  1317. Connect(r_forest1, r_forest5, D_NORTHWEST).
  1318. Connect(r_forest4, r_forest5, D_NORTH).
  1319. AddTail(r_forest5@p_rContents, o_stream).
  1320. AddTail(r_forest5@p_rContents, o_drink).
  1321. AutoGraphics(r_forest5, streamDraw).
  1322. RoomName(r_forest5, "Forest", "").
  1323.  
  1324. define tp_proving0 r_forest6 CreateThing(r_provingForest).
  1325. SetupRoomP(r_forest6, "in a forest between a stream and a hill",
  1326.     "The stream blocks further progress to the west, and the hill presents "
  1327.     "a barrier to the east. You can go northeast, south and southeast.").
  1328. Connect(r_forest2, r_forest6, D_NORTHWEST).
  1329. Connect(r_forest5, r_forest6, D_NORTH).
  1330. AddTail(r_forest6@p_rContents, o_stream).
  1331. AddTail(r_forest6@p_rContents, o_drink).
  1332. Scenery(r_forest6, "hill.barrier").
  1333. define tp_proving0 PR_FOREST6_ID NextEffectId().
  1334. define tp_proving0 proc forest6Draw()void:
  1335.  
  1336.     if not KnowsEffect(nil, PR_FOREST6_ID) then
  1337.     DefineEffect(nil, PR_FOREST6_ID);
  1338.     GSetImage(nil, "pr_forest6");
  1339.     IfFound(nil);
  1340.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  1341.     Else(nil);
  1342.         streamDraw();
  1343.         GSetPen(nil, C_MEDIUM_BROWN);
  1344.         GPolygonStart(nil);
  1345.         GAMove(nil, 159, 15);
  1346.         GRDraw(nil, -46, 27);
  1347.         GRDraw(nil, 0, 16);
  1348.         GRDraw(nil, 46, 26);
  1349.         GPolygonEnd(nil);
  1350.     Fi(nil);
  1351.     EndEffect();
  1352.     fi;
  1353.     CallEffect(nil, PR_FOREST6_ID);
  1354. corp;
  1355. AutoGraphics(r_forest6, forest6Draw).
  1356. RoomName(r_forest6, "Forest", "").
  1357.  
  1358. define tp_proving0 r_forest7 CreateThing(r_provingForest).
  1359. SetupRoomP(r_forest7, "in a forest, north of a small hill",
  1360.     "You can go deeper into the forest to the southwest, or get out of the "
  1361.     "woods to the southeast.").
  1362. Connect(r_forest6, r_forest7, D_NORTHEAST).
  1363. Scenery(r_forest7, "hill;small.wood").
  1364. define tp_proving0 PR_FOREST7_ID NextEffectId().
  1365. define tp_proving0 proc forest7Draw()void:
  1366.  
  1367.     if not KnowsEffect(nil, PR_FOREST7_ID) then
  1368.     DefineEffect(nil, PR_FOREST7_ID);
  1369.     GSetImage(nil, "pr_forest7");
  1370.     IfFound(nil);
  1371.         GShowImage(nil, "", 0, 0, 160, 100, 0, 0);
  1372.     Else(nil);
  1373.         AutoPaths();
  1374.         GSetPen(nil, C_MEDIUM_BROWN);
  1375.         GPolygonStart(nil);
  1376.         GAMove(nil, 25, 99);
  1377.         GRDraw(nil, 45, -29);
  1378.         GRDraw(nil, 20, 0);
  1379.         GRDraw(nil, 45, 29);
  1380.         GPolygonEnd(nil);
  1381.     Fi(nil);
  1382.     EndEffect();
  1383.     fi;
  1384.     CallEffect(nil, PR_FOREST7_ID);
  1385. corp;
  1386. AutoGraphics(r_forest7, forest7Draw).
  1387. RoomName(r_forest7, "Forest", "").
  1388.  
  1389. define tp_proving0 r_fTrail2 CreateThing(r_provingField).
  1390. SetupRoomP(r_fTrail2, "on a trail",
  1391.     "The trail bends here, heading east to a cobbled road, and northwest "
  1392.     "towards a forest.").
  1393. Connect(r_forest7, r_fTrail2, D_SOUTHEAST).
  1394. Connect(r_road2, r_fTrail2, D_WEST).
  1395. Scenery(r_fTrail2, "forest.trail.road;cobbled").
  1396. AutoGraphics(r_fTrail2, AutoPaths).
  1397.  
  1398. unuse tp_proving0
  1399.  
  1400. unuse t_streets
  1401.